home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / winlib.lzh / WINLIB / WLCORE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-18  |  13.8 KB  |  325 lines

  1. /*
  2.  *    WinLIB PRO
  3.  *    Core package header file
  4.  *
  5.  *    Original WinLIB PRO header by Ken Hollis and Karl 0ygard
  6.  *    This header file by Ken Hollis
  7.  *
  8.  *    This header file contains the calls, indices and prototypes to all
  9.  *    of the functions present to the WinLIB PRO Core package.  No part
  10.  *    of this header file may be modified, unless for personal use
  11.  *    only.
  12.  *
  13.  *    For a complete listing of all of the Core package's or any of the
  14.  *    package functions, please refer to "PACKAGE.DOC" for more info.
  15.  *    To order a package, please refer to that same document, or see
  16.  *    the internal help screen, or use IGORView to get more info.
  17.  */
  18.  
  19. #define WM_CREATED    24893    /* Message sent to window when successfully created */
  20. #define WM_KILL        24894    /* Message sent to window when about to be killed */
  21. #define WM_DIALOG    24895    /* Message sent to window upon dialog action */
  22. #define WM_KEYBD    24896    /* Message sent to window upon keypress */
  23. #define WM_BUTTON    24897    /* Message sent to window upon button press */
  24. #define    WM_FKEY        24900    /* Message sent to window upon function key selection */
  25. #define    WM_HELP        24901    /* Message sent to window upon help key selection */
  26. #define    WM_UNDO        24902    /* Message sent to window upon undo key selection */
  27. #define    WM_KBRESET    24903    /* Message sent to window upon keyboard reset (TOS 1.0-1.2) */
  28. #define    WM_MENU        24904    /* Message sent to window upon menu selection */
  29.  
  30. #define WC_NOTOBJECTABLE    0    /* Window can be closed w/o asking */
  31. #define WC_OBJECTABLE        1    /* Pause before closing window */
  32. #define    WC_FORCED            2    /* Force window to be closed */
  33.  
  34. #define TRUE            1    /* Boolean TRUE */
  35. #define FALSE            0    /* Boolean FALSE */
  36. #define FAIL            -1    /* Boolean FAIL */
  37. #define NOMORE        FAIL    /* Window open failure (no more wins) */
  38.  
  39. #define W_OPEN                0x01    /* Window is currently opened */
  40. #define W_MINIMIZED         0x02    /* Window is minimized */
  41. #define W_UNUNTOPPABLE        0x04    /* Window cannot be untopped */
  42. #define W_FULLERMINIMIZES    0x08    /* Window fuller box minimizes */
  43. #define W_BEVENT            0x10    /* Window accepts bkgnd clicks */
  44. #define W_MODAL                0x20    /* Window is modal */
  45. #define    W_TIMER                0x0400    /* Window is a timer */
  46. #define    W_DIALOG            0x0800    /* Window is a dialog */
  47. #define    W_RESERVED1            0x2000    /* These are reserved */
  48. #define    W_RESERVED2            0x4000    /* . */
  49. #define    W_RESERVED3            0x8000    /* for future use */
  50. #define W_DIAL                W_OPEN | W_FULLERMINIMIZES
  51. #define W_ALERT                W_OPEN | W_FULLERMINIMIZES | W_UNUNTOPPABLE | W_MODAL
  52.  
  53. #define    W_MOVE_ATTRIBUTES    NAME|MOVER
  54. #define    W_DIAINF_ATTRIBUTES    NAME|CLOSER|FULLER|MOVER|INFO
  55.  
  56. #define WF_MINIMIZE         24890    /* Minimizable window */
  57. #define WF_UNUNTOPPABLE        24891    /* Cannot untop window */
  58. #define WF_MODAL            24892    /* Modal dialog box */
  59. #define    WF_TIMER            24896    /* Timer window */
  60. #define    WF_DIALOG            24897    /* Dialog window */
  61.  
  62. #define T_STOPPED    0                    /* Timer stopped */
  63. #define T_RUNNING    1                    /* Timer running */
  64. #define    T_PAUSED    2                    /* Timer paused */
  65. #define    T_RESUMED    T_RUNNING            /* Timer resumed */
  66.  
  67. #define    APGI_REGFONT    0    /* Regular font information */
  68. #define    APGI_SMFONT        1    /* Small font information */
  69. #define    APGI_COLORS        2    /* Resolution and color information */
  70. #define    APGI_LANGUAGE    3    /* Language information */
  71. #define    APGI_ENVIRON1    4    /* Environment #1 */
  72. #define    APGI_ENVIRON2    5    /*       .     #2 */
  73. #define    APGI_ENVIRON3    6    /*       .     #3 */
  74. #define    APGI_RESVD1        7    /* Reserved for OS usage */
  75. #define    APGI_MOUSE        8    /* Mouse support information */
  76. #define    APGI_MENU        9    /* Menu support information */
  77. #define    APGI_SHEL        10    /* Shel_write information */
  78. #define    APGI_WINDOW        11    /* Extended WF_ support information */
  79. #define    APGI_MESSAGE    12    /* Extended message information */
  80. #define    APGI_OBJLIB        13    /* Object library information */
  81. #define    APGI_FORMLIB    14    /* Form library information */
  82. #define    APGI_WLGETINFO    -1    /* Get WinLIB PRO information (general) */
  83.  
  84. #define    SHANDLE            'HNDL'
  85. #define    SSTATE            'STAT'
  86. #define    SKIND            'KIND'
  87. #define    SEDITOBJECT        'EOBJ'
  88. #define    SEDITPOS        'EPOS'
  89. #define    SHASEDIT        'HASE'
  90. #define    SEDITDISP        'EDSP'
  91. #define    SAMOUNTMOVED    'AMTM'
  92.  
  93. typedef struct hotkeys {
  94.     char key;
  95.     int objnum;
  96. } HOTKEYS;
  97.  
  98. typedef struct image
  99. {
  100.     int        *hi_on, *hi_off, *lo_on, *lo_off;
  101. } IMAGE;
  102.  
  103. typedef struct images
  104. {
  105.     int        count;
  106.     IMAGE    *image;
  107. } IMAGES;
  108.  
  109. typedef struct window
  110. {
  111.     int                handle;                /* Handle of window */
  112.     int                state;                /* Current state of window
  113.                                             W_OPEN                  = automatically opened
  114.                                             W_MINIMIZED              = "minimized"
  115.                                             W_UNUNTOPPABLE          = un-untoppable window
  116.                                                                     (i.e. requires full attention - should be used with W_MODAL)
  117.                                             W_FULLERMINIMIZES      = window is minimized rather than fulled when FULLER is selected
  118.                                             W_BACKGROUND          = window which can be clicked in in the background
  119.                                             W_MODAL               = window which blocks mouse clicks to all other windows,
  120.                                                                     *even* if they have the W_BACKGROUND mode
  121.                                                                     (i.e. requires full attention - should be used with W_UNUNTOPPABLE)
  122.                                             W_DIALOG              = W_OPEN | W_FULLERMINIMIZES
  123.                                             W_ALERT                  = W_OPEN | W_FULLERMINIMIZES | W_UNUNTOPPABLE | W_MODAL
  124.                                          */
  125.     int                kind;                /* Visual attributes of window */
  126.     GRECT            size;
  127.     char            title[128], info[128], origtitle[128];
  128.                                         /* Title, info and original (untouched) title for window */
  129.     struct window    *prev, *next;        /* Pointer to previous and next window in chain */
  130.     OBJECT            *menubar;            /* Menu bar */
  131.     OBJECT            *tree;                /* Pointer to resource tree */
  132.     int                edobject, edpos;    /* First editable field in resource tree, and position of cursor */
  133.     int                has_edit;            /* Does the dialog box have an editable object? */
  134.     int                edit_disp;            /* Editing cursor displayed flag */
  135.     int                slidpos[10],slidmax[10];    /* Position and maximum position of sliders at any given time */
  136.     long            slidacc[10],slidstep[10];    /* Slider accumulator and step accumulator for the slider routine */
  137.     void            *WndDispatcher;        /* Dispatcher procedures for window */
  138.     void            *user;                /* User parameters to give Dispatcher routines */
  139.     char            *textlines;            /* Text to show inside a window if you've got a text window... */
  140.     int                topline;            /* Line to start printing text from */
  141.     int                amount_moved;        /* Direction, and number of lines that need to be redrawn, the quick way. */
  142.     int                popups[20];            /* These are the selections that have been clicked for your popups. */
  143.     HOTKEYS            hot_keys[20];        /* Hotkey (dialog) information */
  144.     HOTKEYS            hot_text[20];        /* Hotkey (text) information */
  145.     OBJECT            *wininfo;            /* Window elements making up window tree.  It's cheating, but it works! */
  146.     int                toppointer;            /* Character pointer to the first character in the top line */
  147. } WINDOW;
  148.  
  149. typedef struct timer
  150. {
  151.     long    clock;
  152.     long    ev_mtcount;                    /* Timer counter */
  153.     void    *TmrDispatcher;                /* Dispatcher procedure */
  154.     void    *user;                        /* User parameters to give Dispatcher routine */
  155.     int        status;                        /* Status of timer */
  156. } TIMER;
  157.  
  158. typedef struct applinfo
  159. {
  160.     /* Standard messages */
  161.     int    resnum;            /* Current resolution */
  162.     int colsup;            /* Number of colors supported */
  163.     int    colicons;        /* Color icons supported */
  164.     int newrsc;            /* New resource file supported */
  165.     int langidx;        /* Language index */
  166.     int multitask;        /* Preemptive multitasking */
  167.     int extndapfind;    /* Extended ap_find */
  168.     int    applsrch;        /* Appl_search */
  169.     int rcfix;            /* rsrc_rcfix */
  170.     int objcxfind;        /* objc_xfind */
  171.     int menuclick;        /* menu_click */
  172.     int shel_w_r;        /* shel_write/shel_read */
  173.     int applread;        /* appl_read(-1) */
  174.     int    shelget;        /* shel_get(-1) */
  175.     int mbar1;            /* menu_bar(-1) */
  176.     int mbar2;            /* menu_bar(MENU_INSTL) */
  177.     int gmouse;            /* graf_mouse(258-260) */
  178.     int osmouse;        /* Mouse maintained by OS */
  179.     int submnus;        /* Submenus supported */
  180.     int popupmnus;        /* Popup menus supported */
  181.     int scrollable;        /* Scrollable menus supported */
  182.     int exmnsel;        /* Extended MN_SELECTED */
  183.     int wf_support;        /* Extended WF_ support */
  184.     int wf_gadgets;        /* New window gadget support */
  185.     int extra_msgs;        /* Extra messages supported */
  186.     int msgbitfld;        /* Bitfield of extra messages supported */
  187.     int msg_behavior;    /* Message behavior */
  188.     int obj3d;            /* 3D Objects supported */
  189.     int sysvar;            /* objc_sysvar */
  190.     int tedinfofonts;    /* Fonts in TEDINFO structures */
  191.     int fldial;            /* Flying dialogs supported */
  192.     int magix;            /* Mag!x keyboard conversion tables */
  193.     int cpret;            /* Cursor position always returned */
  194.  
  195.     /* WinLIB Standard messages */
  196.     int    wlver;            /* Current version of WinLIB PRO */
  197. } APINFO;
  198.  
  199. extern    int        VDIhandle;
  200. extern    int        ColSupported, Life, Return, Ap_ID;
  201. extern    int        gr_cw, gr_ch, gr_bw, gr_bh, small_font, large_font;
  202. extern    int        color_font, num_colors;
  203. extern    int        num_planes;
  204. extern    int        rsrc_array[15];
  205. extern    char    *prgnameheader;
  206. extern    void    *_MainDispatcher, *_MainKeyDispatcher;
  207. extern    GRECT    desk;
  208. extern    MFDB    screen;
  209. extern    TIMER    Timer;
  210. extern    APINFO    globapinfo;
  211. extern    OBJECT    *MYALERT, *desktop, *iconpopup;
  212. extern    WINDOW    *WindowChain;
  213.  
  214. int        ___DialEditDispatcher(WINDOW *win, int msg_buf[8]);
  215. int        ___EditOptionDispatcher(WINDOW *win, int msg_buf[8]);
  216. int        ___ExtOptionDispatcher(WINDOW *win, int msg_buf[8]);
  217. int        ___ExtendedDispatcher(WINDOW *win, int msg_buf[8]);
  218. int        ___MainHelpDispatcher(WINDOW *win, int msg_buf[8]);
  219. int        ___MainOptionDispatcher(WINDOW *win, int msg_buf[8]);
  220.  
  221. void    box(int x, int y, int w, int h, int color);
  222. void    box_fill(int x, int y, int w, int h, int color);
  223. void    domenu(WINDOW *win);
  224. void    edit_off(WINDOW *win);
  225. void    edit_on(WINDOW *win);
  226. void    edit_pos(WINDOW *win, int where);
  227. void    fill(int x, int y, int color);
  228. void    fillarea(int x1, int y1, int x2, int y2, int interior, int color);
  229. int        find_position(OBJECT *obj, int No, int mx);
  230. void    init_images(void);
  231. void    init_mfdb(MFDB *fm, int *adr, int w, int h, int st, int pl);
  232. void    line(int x1, int y1, int x2, int y2);
  233. void    no_click(void);
  234. void    point(int x, int y, int color);
  235. void    position_fix(OBJECT *obj);
  236. int        rc_intersect(GRECT *r1, GRECT *r2);
  237. int        rc_inside(int x, int y, GRECT *r);
  238. void    reset_vdi(void);
  239. void    restore_clip(void);
  240.  
  241. int        AlertDispatcher(WINDOW *win, int msg_buf[]);
  242. int        CallControlPanel(OBJECT *menu_addr);
  243. void    CallInternalHelp(void);
  244. void    ChangeObjectText(OBJECT *obj, int idx, char *txt, int fnt, int just);
  245. void    DoHorizontalSlide(WINDOW *win, int number, int trackix,
  246.                     int slidix, int leftix, int rightix, int whichix,
  247.                     int trakstep, int strtrack);
  248. void    DoVerticalSlide(WINDOW *win, int number, int trackix,
  249.                     int slidix, int upix, int downix, int whichix,
  250.                     int trakstep, int strtrack);
  251. int        HoldSelection(void);
  252. void    HorizontalSlideReset(WINDOW *win, int number, int maximum, int initial,
  253.                     int trackix, int slidix, int strtrack, int redraw);
  254. void    LockScreenUpdate(void);
  255. void    Objc_Change(OBJECT *tree, int ob_cobject, int ob_crecvd, int ob_cnewstate, int ob_credraw);
  256. int        Rsrc_Free(void);
  257. void    UnlockScreenUpdate(void);
  258. void    VerticalSlideReset(WINDOW *win, int number, int maximum, int initial,
  259.                     int slidix, int trackix, int strtrack, int redraw);
  260. int        WAppl_GetInfo(int ap_gtype, int *ap_gout1, int *ap_gout2, int *ap_gout3, int *ap_gout4);
  261. void    WAppl_SetupInfo();
  262. int        WCallAlertDispatcher(WINDOW *win, int alexit, int alnumber);
  263. int        WCallBtnDispatcher(WINDOW *win, int mx, int my, int button, int kstate, int bclicks);
  264. int        WCallDlgDispatcher(WINDOW *win, int message);
  265. int        WCallEtcDispatcher(int msg_buf[]);
  266. int        WCallFKeyDispatcher(WINDOW *win, int fkeynum);
  267. int        WCallHelpDispatcher(WINDOW *win);
  268. int        WCallKeyDispatcher(int key);
  269. int        WCallResetDispatcher(WINDOW *win, int mode);
  270. int        WCallTmrDispatcher(TIMER *timer);
  271. int        WCallUndoDispatcher(WINDOW *win);
  272. int        WCallWKeyDispatcher(WINDOW *win, int key);
  273. int        WCallWndDispatcher(WINDOW *win, int msg_buf[]);
  274. void    WCruelCloseWindow(WINDOW *win);
  275. void    WCloseWindow(WINDOW *win, int message);
  276. void    WCreateTimer(int status, long ev_tcount, int TmrDispatcher(TIMER *), void *user);
  277. WINDOW    *WCreateWindow(int state, int kind,
  278.                         char *title, char *info,
  279.                         int object, int edobject,
  280.                         int menubar,
  281.                         int WndDispatcher(WINDOW *, int[]),
  282.                         void *user,
  283.                         int x, int y, int w, int h,
  284.                         OBJECT *obj, char textarray[]);
  285. int        WDoDial(void);
  286. void    WDie(int returns);
  287. void    WDragBox(int width, int height, int beginx, int beginy,
  288.                 int boundx, int boundy, int boundw, int boundh,
  289.                 int linecolor, int linetype, int linepattern,
  290.                 int *endx, int *endy, int animate);
  291. int        WForm_button(WINDOW *win, int obj, int clicks, int *nxtobj);
  292. int        WForm_keybd(WINDOW *win, int key, int kstate, int *nobj, int *nchr);
  293. int        WFormCustAlert(int icn, char *text1, char *at1, char *at2, char *at3, char *at4, char *at5,
  294.                         char *bt1, char *bt2, char *bt3);
  295. int        WInit(int ap_id, int *work_out,
  296.                 int DeskWndDispatcher(WINDOW *, int[]),
  297.                 int MainDispatcher(int[]),
  298.                 int KeyDispatcher(int),
  299.                 char *prgname, char *header);
  300. void    WInitAlert(void);
  301. int        WIsTopped(int handle);
  302. void    WKillWindow(WINDOW *win);
  303. void    WKillAllWindows(void);
  304. void    WMoveWindow(WINDOW *win, int x, int y, int w, int h);
  305. int        WMenuBar(OBJECT *me_btree, int me_bshow);
  306. void    WMsgWindow(WINDOW *win, int msg_buf[]);
  307. int        WOpenWindow(WINDOW *win);
  308. void    WReassignWindow(WINDOW *win,
  309.                         int state, int kind, char *title, char *info, 
  310.                         int object, int edobject, int edpos,
  311.                         int menubar, int WndDispatcher(WINDOW *, int[]), 
  312.                         void *user, int w, int h,
  313.                         OBJECT *obj, char textarray[], int redraw);
  314. void    WRedrawAllWindows(void);
  315. void    WRedrawWindow(WINDOW *win, int x, int y, int w, int h);
  316. void    WStartTimer(void);
  317. void    WStopTimer(void);
  318. void    WTerm(void);
  319. TIMER    *WTimerStat(void);
  320. void    WTopWindow(WINDOW *win);
  321. void    WUpdateWindowDlg(WINDOW *win, int x, int y, int w, int h, int obj);
  322. void    WUpdateWindowMenu(WINDOW *win, int x, int y, int w, int h);
  323. int        WWindGet(WINDOW *win, int wi_gfield, ...);
  324. int        WWindSet(WINDOW *win, int wi_sfield, ...);
  325.